package com.edu.exam.entity.exampaper.review;

import com.edu.exam.enums.exampaper.review.SimilarityType;
import com.edu.exam.enums.exampaper.review.SimilarityLevel;
import com.edu.exam.enums.exampaper.review.MatchType;
import jakarta.persistence.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 试卷相似度结果实体类
 *
 * <p>记录试卷相似度分析的详细结果，包括各级维度的相似度数据、
 * 对比分析结果、重复试题信息等。</p>
 *
 * @author 系统生成
 * @version 2.0
 * @since 2025-11-09
 */
@Entity
@Data
@EqualsAndHashCode(callSuper = false)
@EntityListeners(AuditingEntityListener.class)
public class ExamPaperSimilarityResult {

    /**
     * 主键ID
     */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    /**
     * 试卷查重记录ID
     */
    @Column(name = "paper_check_record_id", nullable = false)
    private Long paperCheckRecordId;

    /**
     * 相似度类型
     */
    @Enumerated(EnumType.STRING)
    @Column(name = "similarity_type", nullable = false, length = 20)
    private SimilarityType similarityType;

    /**
     * 源试卷ID
     */
    @Column(name = "paper_id", nullable = false)
    private Long paperId;

    /**
     * 目标试卷ID
     */
    @Column(name = "target_paper_id")
    private Long targetPaperId;

    /**
     * 源试题ID
     */
    @Column(name = "question_id")
    private Long questionId;

    /**
     * 目标试题ID
     */
    @Column(name = "target_question_id")
    private Long targetQuestionId;

    /**
     * 试题序号
     */
    @Column(name = "question_sequence")
    private Integer questionSequence;

    /**
     * 目标试题序号
     */
    @Column(name = "target_question_sequence")
    private Integer targetQuestionSequence;

    /**
     * 相似度分数
     */
    @Column(name = "similarity_score", precision = 5, scale = 2)
    private BigDecimal similarityScore;

    /**
     * 内容相似度
     */
    @Column(name = "content_similarity", precision = 5, scale = 2)
    private BigDecimal contentSimilarity;

    /**
     * 选项相似度
     */
    @Column(name = "options_similarity", precision = 5, scale = 2)
    private BigDecimal optionsSimilarity;

    /**
     * 答案相似度
     */
    @Column(name = "answer_similarity", precision = 5, scale = 2)
    private BigDecimal answerSimilarity;

    /**
     * 解析相似度
     */
    @Column(name = "explanation_similarity", precision = 5, scale = 2)
    private BigDecimal explanationSimilarity;

    /**
     * 题型相似度
     */
    @Column(name = "question_type_similarity", precision = 5, scale = 2)
    private BigDecimal questionTypeSimilarity;

    /**
     * 难度相似度
     */
    @Column(name = "difficulty_similarity", precision = 5, scale = 2)
    private BigDecimal difficultySimilarity;

    /**
     * 知识点相似度
     */
    @Column(name = "knowledge_point_similarity", precision = 5, scale = 2)
    private BigDecimal knowledgePointSimilarity;

    /**
     * 分值相似度
     */
    @Column(name = "score_similarity", precision = 5, scale = 2)
    private BigDecimal scoreSimilarity;

    /**
     * 相似度等级
     */
    @Enumerated(EnumType.STRING)
    @Column(name = "similarity_level", length = 20)
    private SimilarityLevel similarityLevel;

    /**
     * 匹配类型
     */
    @Enumerated(EnumType.STRING)
    @Column(name = "match_type", length = 20)
    private MatchType matchType;

    /**
     * 置信度
     */
    @Column(name = "confidence_level", precision = 3, scale = 2)
    private BigDecimal confidenceLevel;

    /**
     * 是否高度相似
     */
    @Column(name = "is_high_similarity")
    private Boolean isHighSimilarity;

    /**
     * 完全匹配标志
     */
    @Column(name = "is_exact_match")
    private Boolean isExactMatch;

    /**
     * 部分匹配标志
     */
    @Column(name = "is_partial_match")
    private Boolean isPartialMatch;

    /**
     * 匹配详情
     */
    @Column(name = "match_details", columnDefinition = "TEXT")
    private String matchDetails;

    /**
     * 差异分析
     */
    @Column(name = "difference_analysis", columnDefinition = "TEXT")
    private String differenceAnalysis;

    /**
     * 源内容文本
     */
    @Column(name = "source_content", columnDefinition = "TEXT")
    private String sourceContent;

    /**
     * 目标内容文本
     */
    @Column(name = "target_content", columnDefinition = "TEXT")
    private String targetContent;

    /**
     * 对比片段
     */
    @Column(name = "comparison_segments", columnDefinition = "TEXT")
    private String comparisonSegments;

    /**
     * 相似片段
     */
    @Column(name = "similar_segments", columnDefinition = "TEXT")
    private String similarSegments;

    /**
     * 差异片段
     */
    @Column(name = "different_segments", columnDefinition = "TEXT")
    private String differentSegments;

    /**
     * 权重系数
     */
    @Column(name = "weight_factor", precision = 3, scale = 2)
    private BigDecimal weightFactor;

    /**
     * 算法版本
     */
    @Column(name = "algorithm_version", length = 50)
    private String algorithmVersion;

    /**
     * 计算参数
     */
    @Column(name = "calculation_params", columnDefinition = "TEXT")
    private String calculationParams;

    /**
     * 扩展属性
     */
    @Column(name = "extended_attributes", columnDefinition = "TEXT")
    private String extendedAttributes;

    /**
     * 备注信息
     */
    @Column(name = "remarks", length = 500)
    private String remarks;

    /**
     * 创建人ID
     */
    @Column(name = "created_by")
    private Long createdBy;

    /**
     * 更新人ID
     */
    @Column(name = "updated_by")
    private Long updatedBy;

}
